#include <iostream>

using namespace std;
/*
int & test01()
{
    int a = 10;
    return a;
}
*/

int & test02()
{
    static int a = 10;//静态变量，存放在全局区
    return a;
}

int main(void)
{
    //引用做函数的返回值
    //1、不要返回局部变量的引用
    //int &ref = test01();
    //cout << "ref = " << ref << endl;
    // 2、函数的调用可以作为左值

    int &ref = test02();
    cout << "ref = " << ref << endl;
    test02() = 1000;
    cout << "ref = " << ref << endl; 

    return 0;
}